home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Examples / A-Z / G / GridViews / Row Selection in Grid Views / UApplicationRowSelect.cp < prev    next >
Encoding:
Text File  |  1996-04-03  |  5.1 KB  |  135 lines  |  [TEXT/MPS ]

  1. //----------------------------------------------------------------------------------------
  2. // URowSelectApplication.cp
  3. // Copyright © 1991-96 by Apple Computer, Inc. All rights reserved. 
  4. //----------------------------------------------------------------------------------------
  5.  
  6. #ifndef __UApplicationRowSelect__
  7. #include "UApplicationRowSelect.h"
  8. #endif
  9.  
  10. #ifndef __UDocumentRowSelect__
  11. #include "UDocumentRowSelect.h"
  12. #endif
  13.  
  14. // MacApp Includes
  15.  
  16. #ifndef __UMENUMGR__
  17. #include "UMenuMgr.h"
  18. #endif
  19.  
  20. //----------------------------------------------------------------------------------------
  21. // Constants:
  22.  
  23. const OSType kSignature            = 'SS01';            // Application signature
  24.         
  25. //========================================================================================
  26. // CLASS TApplicationRowSelect
  27. //========================================================================================
  28. #undef Inherited
  29. #define Inherited TApplication
  30.  
  31. #pragma segment AInit
  32. MA_DEFINE_CLASS_M1(TApplicationRowSelect, Inherited);
  33.  
  34. //----------------------------------------------------------------------------------------
  35. // TApplicationRowSelect constructor
  36. //----------------------------------------------------------------------------------------
  37. #pragma segment AOpen
  38.  
  39. TApplicationRowSelect::TApplicationRowSelect()
  40. {
  41.     // Initialize fields to safe values here
  42. }
  43.  
  44. //----------------------------------------------------------------------------------------
  45. // TApplicationRowSelect destructor
  46. //----------------------------------------------------------------------------------------
  47. #pragma segment MADestructorRes
  48.  
  49. TApplicationRowSelect::~TApplicationRowSelect()
  50. {
  51. }
  52.  
  53. //----------------------------------------------------------------------------------------
  54. // TApplicationRowSelect::IApplicationRowSelect: 
  55. //----------------------------------------------------------------------------------------
  56. #pragma segment AInit
  57.  
  58. void TApplicationRowSelect::IApplicationRowSelect()
  59. {
  60.     this->IApplication(kFileType, kSignature);
  61. } // TApplicationRowSelect::IApplicationRowSelect 
  62.  
  63. //----------------------------------------------------------------------------------------
  64. // TApplicationRowSelect::DoMakeDocument: This method is overridden to return a document
  65. // object of the appropriate class for this application. MacApp calls this method when the
  66. // user chooose New or Open from the File menu. For applications which hande multiple
  67. // document types, the command number can be used to discriminate between different user
  68. // requests. The file object represents the file chosen by the user in the Standard File
  69. // dialog.
  70. //----------------------------------------------------------------------------------------
  71. #pragma segment AOpen
  72.             
  73. TDocument* TApplicationRowSelect::DoMakeDocument(CommandNumber /* itsCommandNumber */,
  74.                                                         TFile* itsFile) // Override 
  75. {
  76.     TDocumentRowSelect* aDocument = new TDocumentRowSelect;
  77.     
  78.     aDocument->IDocumentRowSelect(itsFile,kSignature);
  79.     return aDocument;
  80. } // TApplicationRowSelect::DoMakeDocument 
  81.  
  82. //----------------------------------------------------------------------------------------
  83. // TApplicationRowSelect::DoMenuCommand: This method is overridden to handle menu items
  84. // which are enabled when this object is in the target chain. The application object is
  85. // always in the target chain.
  86. // 
  87. // The inherited method is called so that MacApp can handle application-level menu items
  88. // like the "About " menu item in the Apple menu.
  89. //----------------------------------------------------------------------------------------
  90. #pragma segment ASelCommand
  91.  
  92. void TApplicationRowSelect::DoMenuCommand(CommandNumber aCommandNumber) // Override 
  93. {
  94.     switch (aCommandNumber) 
  95.     {
  96.         /*    Typically, you will have dispatch your own menu commands here:
  97.         case cCommandHandledByApplication : 
  98.             SysBeep(2);
  99.             break;
  100.         */
  101.         default:
  102.             Inherited::DoMenuCommand(aCommandNumber);
  103.             break;
  104.     }
  105. } // TApplicationRowSelect::DoMenuCommand 
  106.  
  107. //----------------------------------------------------------------------------------------
  108. // TApplicationRowSelect::DoSetupMenus: This method is overridden to enable menu items
  109. // which should be enabled when this object is in the target chain. MacApp initially
  110. // disables all menu items, then lets the objects in the target chain enable those items
  111. // they handle.
  112. //
  113. // The application object is always in the target chain, so the About menu item in the
  114. // Apple menu and the item with command number cMenuHandledByApplication should be enabled
  115. // even if there are no open documents.
  116. // 
  117. // The inherited method is called so that MacApp can enable application-level menu items
  118. // like the "About " menu item.
  119. //----------------------------------------------------------------------------------------
  120. #pragma segment ARes
  121.  
  122. void TApplicationRowSelect::DoSetupMenus() // Override 
  123. {
  124.     Inherited::DoSetupMenus();                // Always call the inherited method first
  125.  
  126.     /*    Typically, you will have enable your own menu commands here:
  127.     Enable(cCommandHandledByApplication,TRUE);
  128.     */
  129. } // TApplicationRowSelect::DoSetupMenus 
  130.  
  131. //----------------------------------------------------------------------------------------
  132. // End of UApplicationRowSelect.cp
  133.  
  134. #pragma segment Inline
  135.